package com.xintoucloud.pbs.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xintoucloud.pbs.model.Node;
import com.xintoucloud.pbs.service.MenuService;

@Controller@RequestMapping("/menu")
public class MenuController {
	@Autowired
	private MenuService menuService;
	
	@RequestMapping("/showAdminMenu")
	public String showAdminMenu(Model m) {
		System.out.println("运行了");
		List <Node> nodes=menuService.listNodeByParentId(0,1);
		for (Node node : nodes) {
			node.setState("closed");
			//System.out.println(node.getText());
		}
		m.addAttribute("nodes", nodes);
		return "index";
	}
}
